package com.xian.test.scala.stream

import java.util.Date

import com.xian.test.scala.bean.Person
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}
import org.apache.flink.streaming.api.scala._

/**
 * flink 流式读取集合
 */
object StreamReadCollection {
  def main(args: Array[String]): Unit = {
    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

    val persons = List(
      new Person(3, "jemson", new Date()),
      new Person(1, "jemson", new Date(1610600173)),
      new Person(5, "jemson", new Date(1610600173000L)),
      new Person(7, "jemson", new Date(1610600273000L)),
      new Person(2, "jemson", new Date(1610660473000L))
    )

    val personsDS: DataStream[Person] = env.fromCollection(persons)

    personsDS.print()








    env.execute("com.xian.test.scala.MyTest")
  }
}
